<template>
	<view class="video">
		<top-header :value="3"></top-header>
		<view class="video_region">
			<view class="nav">
				<view class="item">
					<i class="_new ico"></i>
					<view class="text">最新</view>
				</view>
				<view class="item">
					<i class="_my ico"></i>
					<view class="text">我的</view>
				</view>
				<view class="item" @click="toSubVideo">
					<i class="_add ico"></i>
					<view class="text">上传</view>
				</view>
				<view class="item">
					<i class="_so ico"></i>
					<view class="text">筛选</view>
				</view>
			</view>
			<view class="list">
				<view class="item" v-for="(item,index) in videoList" :key="index">
					<video :src="item.videoUrl" class="video_img" object-fit="fill"></video>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			videoList:[],
		};
	},
	onShow() {
		this.getVideo()
	},
	methods:{
		toSubVideo(){
			uni.navigateTo({
				url:'/pages/subVideo/subVideo'
			})
		},
		async getVideo(){
			let res = await this.request({
				url:'/video',
				method:'GET'
			})
			console.log(res);
			this.videoList = res.data.filter((item) => {
				return item.state == 1
			})
			console.log(this.videoList);
		}
	}
};
</script>

<style lang="scss">
.video {
	padding: 120rpx 0 104rpx;
	.video_region {
		padding: 0 24rpx;
		box-sizing: border-box;
		.nav {
			display: flex;
			width: 100%;
			padding: 20rpx 0;
			box-sizing: border-box;
			background-color: #fff;
			border-radius: 20rpx;
			.item {
				width: 25%;
				display: flex;
				flex-flow: column;
				align-items: center;
				justify-content: center;
				.ico {
					width: 80rpx;
					height: 80rpx;
					border-radius: 50%;
					display: flex;
					justify-content: center;
					align-items: center;
					color: #fff;
					font-size: 40rpx;
				}
				.text {
					margin-top: 10rpx;
					font-size: 28rpx;
				}
				._new {
					background-color: #436ff6;
					background-image: -webkit-linear-gradient(135deg, #436ff6, #8abef9);
					text-shadow: 0rpx 2rpx 2rpx #002fbe;
				}

				._my {
					background-color: #fd6eba;
					background-image: -webkit-linear-gradient(135deg, #fd6eba, #ffabd8);
					text-shadow: 0rpx 2rpx 2rpx #d02982;
				}

				._add {
					background-color: #ff8400;
					background-image: -webkit-linear-gradient(135deg, #ff8400, #febe13);
					text-shadow: 0rpx 2rpx 2rpx #b45f03;
				}

				._so {
					background-color: #7b38f5;
					background-image: -webkit-linear-gradient(135deg, #7b38f5, #bf92f8);
					text-shadow: 0rpx 2rpx 2rpx #4e08cd;
				}
			}
		}
		.list {
			display: flex;
			flex-flow: wrap;
			margin-top: 40rpx;
			.item {
				width: 47%;
				height: 494rpx;
				margin: 0 10rpx 20rpx;
				border-radius: 24rpx;
				position: relative;
				overflow: hidden;
				.like {
					position: absolute;
					top: 30rpx;
					right: 0;
					border-radius: 40rpx 0 0 40rpx;
					color: #fff;
					display: flex;
					align-items: center;
					justify-content: center;
					font-size: 24rpx;
					padding: 10rpx 20rpx 10rpx 30rpx;
					background-color: rgba(0, 0, 0, 0.1);
					.ico {
						font-size: 24rpx;
						margin-right: 10rpx;
					}
				}
				.hot {
					position: absolute;
					top: 110rpx;
					right: 0;
					border-radius: 40rpx 0 0 40rpx;
					color: #fff;
					display: flex;
					align-items: center;
					justify-content: center;
					font-size: 24rpx;
					padding: 10rpx 20rpx 10rpx 30rpx;
					background-color: rgba(0, 0, 0, 0.1);
					.ico {
						font-size: 24rpx;
						margin-right: 10rpx;
					}
				}
				.start_icon {
					position: absolute;
					top: 50%;
					left: 50%;
					transform: translate(-50%, -50%);
					font-size: 80rpx;
					color: #fff;
					opacity: 0.6;
				}
				.userInfo {
					position: absolute;
					width: 100%;
					left: 0;
					bottom: -6rpx;
					display: flex;
					align-items: center;
					padding: 10rpx 20rpx;
					.avatar {
						width: 60rpx;
						height: 60rpx;
						border-radius: 50%;
					}
					.name {
						padding: 0 10rpx;
						box-sizing: border-box;
						min-width: 220rpx;
						flex: 1;
						height: 80rpx;
						line-height: 80rpx;
						font-size: 24rpx;
						white-space: nowrap;
						overflow: hidden;
						text-overflow: ellipsis;
						color: #fff;
						background: -webkit-linear-gradient(90deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0) 100%);
					}
				}
				.video_img {
					width: 100%;
					height: 494rpx;
					z-index: 0;
				}
			}
		}
	}
}
</style>
